package cn.jbolt.ai.demo.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.jbolt.util.ReflectiveApiCall;
import cn.jbolt.util.Result;
import org.springframework.stereotype.Service;

@Service
public class FunctionCallTestService {

    public Result testFunctionCallReflective(String packageAndClassName, String methodName, String param1, String param2) {
        return ReflectiveApiCall.callApi(packageAndClassName, methodName, param1, param2);
    }


    public Result searchOrder(String userName) {
        JSONArray list = new JSONArray();
        list.add(new JSONObject().fluentPut("sn", "2023110187654565").fluentPut("createTime", "2023/11/01").fluentPut("amount", 99.9).fluentPut("state", "支付成功"));
        list.add(new JSONObject().fluentPut("sn", "2024010184334751").fluentPut("createTime", "2024/01/01").fluentPut("amount", 199.9).fluentPut("state", "支付成功"));
        list.add(new JSONObject().fluentPut("sn", "2024110194556441").fluentPut("createTime", "2024/11/01").fluentPut("amount", 9.9).fluentPut("state", "支付失败"));
        return Result.success(list);
    }


    /**
     * 招聘
     *
     * @param departmentName 部门名称
     * @param jobName        岗位名称
     * @return
     */
    public Result inviteJob(String departmentName, String jobName) {

        String title = "xxxx公司"+departmentName + "招聘";
        String content= "岗位:"+jobName+"，招聘人数：1人，岗位要求：刻苦学习";
        String  html =   title + "<br/>" + content+"<br/>"+"欢迎您的加入!";
        return Result.success(html);
    }

    /**
     * 我要找工作
     * @param areaName 地区
     * @param jobName 工作岗位
     * @return
     */
    public Result JobSearch(String areaName, String jobName) {
        String content= "我想在"+areaName+"地区,找一个"+jobName+"的岗位";
        return Result.success(content);
    }
}
